CmdUtils.makeSearchCommand({  
  name: "gdefine",  
  url: "http://www.google.com/search?defl=en&q=define:{QUERY}",
  icon: "http://www.google.com/favicon.ico",  
  description: "Searches Google for your words using the 'define' command.",
  author: {name: "Isac Sacchi e Souza", email: "isacssouza@gmail.com"},
  license: "Public domain",
  preview: function(pblock, directObject) {    
    var searchTerm = directObject.text;    // Don't even display any text before fetching search results,
                                           // since the results come back nearly instantaneously. In the
                                           // future, we can display a throbber.

    if(searchTerm.length < 1) {      
      pblock.innerHTML = "Searches Google for your words using the 'define' command.";
      return;    
    }

    var defineSearch = "define"+encodeURIComponent(':')+searchTerm;
    var url = "http://www.google.com/search?defl=en&q="+defineSearch;
    CmdUtils.previewGet( pblock, url, null, function(data) {
      var resultDivPos = data.indexOf("ssb", 0);
      var beginPos = data.indexOf("<ul", resultDivPos);
      var endPos = data.indexOf("</ul>", beginPos);
      pblock.innerHTML = "<p>Definitions of <b>"+searchTerm+"</b> on the Web:</p>"+data.substring(beginPos, endPos);
    });
  }});

